<template>
  <div class="pre-screening-results">
    <div class="resultsStatus">
      <van-icon v-if="type == '' || type == undefined" name="checked"/>
      <van-icon v-if="type == 'refuse'" name="clear"/>
      <p class="title" v-if="type == '' || type == undefined">签约成功</p>
      <p class="title" v-if="type == 'refuse'">签约失败</p>
      <p class="refuseTip" v-if="type == 'refuse'">很抱歉通知您，根据您的资信情况，合同已自动失效，敬请谅解！</p>
    </div>
    <div class="btn-group">
      <div class="btn">
        <router-link :to="{ path:'/loanPage/newHome' }">返回首页</router-link>
      </div>
      <div class="btn btn-primary" v-if="type == '' || type == undefined">
        <router-link :to="{ path:'/loanPage/newHome' }">立即用款</router-link>
      </div>
    </div>
    <div class="footer">
      <div v-if="type == '' || type == undefined">温馨提示：</div>
      <p class="Tip" v-if="type == '' || type == undefined">我行未与其他机构或个人合作办理经营贷款并收取任何额外费用。除我行与您在借款合同中约定的、我行公示的收费项目外，我行及我行员工均不会向您额外收取其他任何费用或款项。若您收到可疑电话、短信、链接等，请勿轻信，谨防受骗。如有疑问，可致电我行客服热 </p>

      <p class="refuseTip" v-if="type == 'refuse'">详情请联系客户经理，或致电我行客服热线</p>
      <p class="red">{{ phoneNum }}</p>
    </div>
  </div>
</template>

<script>
/**
 * <adoptStatus :type="'refuse'" :phoneNum="'0000-00000000'"></adoptStatus>
 * type:  1.不传值表示 通过  2.传refuse值表示 不通过
 */
export default {
  name: "adoptStatus",
  props: ['type', 'phoneNum', 'dataObj'],
  components: {},
  data() {
    return {}
  },
  created() {
    //  更改合同状态
    this.updateStatus(this.dataObj)
  },
  methods: {
    /**
     * 更改合同状态
     * @param item
     */
    updateStatus(item) {
      console.log(item)
      this.$toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true,
        message: '加载中...'
      });
      let param = {
        contract_id: item['CONTRACT_ID'],//合同编号
        contract_status: '01',//合同状态 item['CONTRACT_STATUS']
        sign_status: '01',//签约状态item['SIGN_STATUS']
      }
      this.baseService.postForm(this.__ctx + '/plugin/mobileBusiCenter/saveSingStatus', param).then(res => {
        this.$toast.clear();
        if (res.isOk) {
          //如果又返回taskid
          console.log("------", res)

        } else {
          this.$toast({
            icon: 'warning',
            message: res.msg
          });
        }
      }, function (status) {
        this.$toast.clear();
        if (status == !0) {
          this.$toast({
            icon: 'warning',
            message: '加载失败！' + status
          });
        }
      });
    },
  }
}

</script>

<style scoped lang="less">
.content_box {
  margin: 5.8rem 0rem 0rem 0rem;
}

.pre-screening-results {
  font-size: 1.3rem;
  line-height: 2rem;
  font-family: PingFang SC-Regular, PingFang SC;
  font-weight: 400;
  color: rgb(134, 144, 156);
  background-color: #FFFFFF;
  height: calc(100vh - 5.8rem);
  position: relative;
}

.pre-screening-results .resultsStatus {
  padding: 4rem;
  text-align: center;
}

.pre-screening-results .refuseTip {
  text-align: left;
}

.pre-screening-results .van-icon-clear {
  color: rgb(254, 93, 61) !important;
  font-size: 6rem;
}

.pre-screening-results .van-icon-checked {
  color: rgb(97, 210, 67) !important;
  font-size: 6rem;
}

.pre-screening-results .title {
  font-size: 2rem;
  color: rgb(78, 89, 105);
  margin: 1.6rem;
}

.pre-screening-results .btn-group {
  display: flex;
  justify-content: center;
}

.pre-screening-results .btn {
  width: 30%;
  padding: 6px 0;
  font-size: 1.4rem;
  font-weight: 400;
  text-align: center;
  border-radius: 4.4rem;
  margin: 0 0.8rem;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.pre-screening-results .btn a {
  color: var(--primary-color);
}

.pre-screening-results .btn-primary {
  color: #ffffff;
  border: 1px solid var(--primary-color);
  background: var(--primary-color);
}

.pre-screening-results .btn-primary a {
  color: #ffffff;
}

.footer {
  /*width: calc(100% - 4.8rem);*/
  padding: 0 2.4rem;
  /*position: fixed;*/
  position: absolute;
  bottom: 2.4rem;
  left: 0;
  font-size: 1.2rem;
  color: rgb(134, 144, 156);
}

.footer div {
  color: rgb(78, 89, 105);
  font-size: 1.2rem;
  line-height: 2rem;
}

.footer .refuseTip {
  text-align: center;
}

.footer .red {
  color: rgb(255, 74, 50);
  margin-top: 0.5rem;
  text-align: center;
}
</style>
